Use master
Create Database PM1
on
(
	name = PM1_dat,
	filename = 'C:\Program Files (x86)\Microsoft SQL Server\MSSQL.1\MSSQL\Data\PM1dat.mdf',
	size = 50MB,
	maxsize = 100MB,
	filegrowth = 5MB
)
log on
(
	name = PM1_log,
filename = 'C:\Program Files (x86)\Microsoft SQL Server\MSSQL.1\MSSQL\Data\PM1dat.ldf',
size =5MB,
mAXSIZE = 25MB ,
FILEGROWTH = 5MB
)
go
use PM1
go
create table Patient(
PatientID nvarchar(10) primary key not null,
FirstName nvarchar(50),
LastName nvarchar(50),
Address nvarchar(50),
Weight float,
Phone nvarchar(50),
Blood char(10),
Sex bit,
Birthday datetime,
Notes text,
Email nvarchar(50),
)

Create table Department(
DepartmentID nvarchar(10) primary key not null,
DepartmentName nvarchar(50)
)
Create table Doctor(
DoctorID nvarchar(10) primary key not null,
FirstName nvarchar(50),
LastName nvarchar(50),
DepartmentID nvarchar(10) FOREIGN KEY REFERENCES Department,
Address nvarchar(50),
Email nvarchar(50),
Phone nvarchar(50),
Speciality nvarchar(50),
Availability bit
)
Create table Room
(
	RoomID nvarchar(10) primary key not null,
	RoomName nvarchar(50),
	DepartmentID nvarchar(10) FOREIGN KEY REFERENCES Department
)
Create table Bed
(
	BedID nvarchar(10) primary key not null,
	RoomID nvarchar(10) FOREIGN KEY REFERENCES Room not null,
	BedStatus bit not null
)
Create table CaseHistory
(
	CaseID nvarchar(10) primary key not null,
	PatientID nvarchar(10) FOREIGN KEY REFERENCES Patient,
	CaseHistory nvarchar(50),
	AdmissionDate datetime,
	DischargeDate datetime,
	CaseStatus bit
)
Create table Treatment(
	TreatID nvarchar(10) primary key not null,
	CaseID nvarchar(10) FOREIGN KEY REFERENCES CaseHistory,
	DoctorID nvarchar(10) FOREIGN KEY REFERENCES Doctor,
	BedID nvarchar(10) FOREIGN KEY REFERENCES Bed,
	Reason nvarchar(max),
	Date datetime
)